package edu.spec.basic.model;

import edu.spec.basic.model.anno.Excel;
import edu.spec.basic.model.enumeration.AccountStatus;
import edu.spec.basic.model.enumeration.Gender;
import edu.spec.basic.model.enumeration.JobType;
import edu.spec.basic.model.enumeration.YesNo;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name="t_user", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_name"})})
public class User {

	private Integer id;
	private Date createDate;
	private Date updateDate;
	private AccountStatus accountStatus;
	private String des;
	private String password;
	@Excel(columnName="教工号",exportWidth=20,exportConvert=false,importConvert=false)
	private String username;
	@Excel(columnName="姓名",exportWidth=20,exportConvert=false,importConvert=false)
	private String realName;
    @Excel(columnName="身份证号",exportWidth=20,exportConvert=false,importConvert=false)
	private String idNumber;
    private Gender gender;
    private String openId;
    // 是否党员：0，是；1不是
    private YesNo isCommunist;
    // 是否正式编内：0，是；1不是
    private YesNo isFormal;
    // 岗位类别：0，系主任；1，领导干部；2，行政工作人员；3，学生工作人员；4，专任教师
	private JobType jobType;
	private User owner;
	private Org org;

    public User() {
    }

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "create_date")
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Column(name = "update_date")
	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

    public AccountStatus getAccountStatus() {
        return accountStatus;
    }

    public void setAccountStatus(AccountStatus accountStatus) {
        this.accountStatus = accountStatus;
    }

    @Column(name = "des")
	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	@Column(name = "password")
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "real_name")
	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	@Column(name = "user_name")
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

    @Column(name = "id_number")
    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    @Column(name = "gender")
    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    @Column(name = "open_id")
    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    @Column(name = "is_communist")
    public YesNo getIsCommunist() {
        return isCommunist;
    }

    public void setIsCommunist(YesNo isCommunist) {
        this.isCommunist = isCommunist;
    }

    @Column(name = "is_formal")
    public YesNo getIsFormal() {
        return isFormal;
    }

    public void setIsFormal(YesNo isFormal) {
        this.isFormal = isFormal;
    }

    @Column(name = "job_type")
	public JobType getJobType() {
		return jobType;
	}

	public void setJobType(JobType jobType) {
		this.jobType = jobType;
	}

	@ManyToOne
	@JoinColumn(name = "owner_id")
	public User getOwner() {
		return owner;
	}

	public void setOwner(User owner) {
		this.owner = owner;
	}

	@ManyToOne
	@JoinColumn(name = "org_id")
	public Org getOrg() {
		return org;
	}

	public void setOrg(Org org) {
		this.org = org;
	}
}
